class Solution {
public:
    bool isPalindrome(string s) {
int n;
 string d;
        for (char ch: s) {
            if (isalnum(ch)) {
                d += tolower(ch);
            }
        }
         n = d.size();
        int l = 0, r = n - 1;
        while (l < r) {
           if (d[l] != d[r]) {
                return false;
            }
            ++l;
            --r;
        }
        return true;
    }
};